import Vue from vue;
import VueRouter from 'vue-router';
import VueResource from 'vue-resource';

Vue.use(VueRouter);
Vue.use(VueResource);

// const serverUrl = 'http://localhost:3000/api'
//定义组件
function loadTemplate(id) {
    return document.getElementById(id + '_tmpl').innerHTML;
}

 const Meeting = Vue.extend({
    template: '<h1>iiii</h1>' ,
    data () {
        return { data: {} }
      },
    route:{
        data (transition) {
            const id = transition.to.params.id ;
          this.$http.get(`api/:${id}`).then((response) => {
            //   var json=JSON.parse(response);
            //   console.log(json);

          }, (response) => {
              //error
          })
        }
    }
      
});

var  router = new VueRouter();
router.map({
    '/':{

    },
    '/api/:id':{
        component: Meeting
    }
});




